home *** CD-ROM | disk | FTP | other *** search
/ Multimedia Jumpstart / Multimedia Microsoft Jumpstart Version 1.1a (Microsoft).BIN / develpmt / sdk / vfw11.win / vfwdk / codec.h_ / codec.bin
Encoding:
Text File  |  1994-03-03  |  9.8 KB  |  350 lines

  1. //==========================================================================;
  2. //
  3. //  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  4. //  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  5. //  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  6. //  PURPOSE.
  7. //
  8. //  Copyright (c) 1992, 1994  Microsoft Corporation.  All Rights Reserved.
  9. //
  10. //--------------------------------------------------------------------------;
  11. //
  12. //  codec.h
  13. //
  14. //  Description:
  15. //
  16. //
  17. //
  18. //==========================================================================;
  19.  
  20. #ifndef _INC_CODEC
  21. #define _INC_CODEC                  // #defined if codec.h has been included
  22.  
  23. #ifndef RC_INVOKED
  24. #pragma pack(1)                     // assume byte packing throughout
  25. #endif
  26.  
  27. #ifndef EXTERN_C
  28. #ifdef __cplusplus
  29.     #define EXTERN_C extern "C"
  30. #else
  31.     #define EXTERN_C extern 
  32. #endif
  33. #endif
  34.  
  35. #ifdef __cplusplus
  36. extern "C"                          // assume C declarations for C++
  37. {
  38. #endif
  39.  
  40. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; 
  41. //
  42. //  ACM Driver Version:
  43. //
  44. //  the version is a 32 bit number that is broken into three parts as 
  45. //  follows:
  46. //
  47. //      bits 24 - 31:   8 bit _major_ version number
  48. //      bits 16 - 23:   8 bit _minor_ version number
  49. //      bits  0 - 15:   16 bit build number
  50. //
  51. //  this is then displayed as follows (in decimal form):
  52. //
  53. //      bMajor = (BYTE)(dwVersion >> 24)
  54. //      bMinor = (BYTE)(dwVersion >> 16) & 
  55. //      wBuild = LOWORD(dwVersion)
  56. //
  57. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; 
  58.  
  59. #define VERSION_ACM_DRIVER_MAJOR    2
  60. #define VERSION_ACM_DRIVER_MINOR    2
  61. #define VERSION_ACM_DRIVER_BUILD    0
  62.  
  63. #define VERSION_ACM_DRIVER      MAKE_ACM_VERSION(VERSION_ACM_DRIVER_MAJOR,  \
  64.                                                  VERSION_ACM_DRIVER_MINOR,  \
  65.                                                  VERSION_ACM_DRIVER_BUILD)
  66.  
  67. //
  68. //  version of the ACM that this driver was designed for (requires)..
  69. //
  70. #define VERSION_MSACM       MAKE_ACM_VERSION(2, 1, 0)
  71.  
  72.  
  73.  
  74. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; 
  75. // 
  76. //  Win 16/32 portability stuff...
  77. // 
  78. // 
  79. // 
  80. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; 
  81.  
  82. #ifndef WIN32
  83.     #ifndef FNLOCAL
  84.         #define FNLOCAL     NEAR PASCAL
  85.         #define FNCLOCAL    NEAR _cdecl
  86.         #define FNGLOBAL    FAR PASCAL
  87.         #define FNCGLOBAL   FAR _cdecl
  88.     #ifdef _WINDLL
  89.         #define FNWCALLBACK FAR PASCAL __loadds
  90.         #define FNEXPORT    FAR PASCAL __export
  91.     #else
  92.         #define FNWCALLBACK FAR PASCAL
  93.         #define FNEXPORT    FAR PASCAL __export
  94.     #endif
  95.     #endif
  96.  
  97.     //
  98.     //
  99.     //
  100.     //
  101.     #ifndef FIELD_OFFSET
  102.     #define FIELD_OFFSET(type, field)    ((LONG)&(((type *)0)->field))
  103.     #endif
  104.  
  105.     //
  106.     //  based code makes since only in win 16 (to try and keep stuff out of
  107.     //  our fixed data segment...
  108.     //
  109.     #define BCODE           _based(_segname("_CODE"))
  110.  
  111.     #define HUGE            _huge
  112.  
  113.     //
  114.     //  stuff for Unicode in Win 32--make it a noop in Win 16
  115.     //
  116.     #ifndef _TCHAR_DEFINED
  117.         #define _TCHAR_DEFINED
  118.         typedef char            TCHAR, *PTCHAR;
  119.         typedef unsigned char   TBYTE, *PTUCHAR;
  120.  
  121.         typedef PSTR            PTSTR, PTCH;
  122.         typedef LPSTR           LPTSTR, LPTCH;
  123.         typedef LPCSTR          LPCTSTR;
  124.     #endif
  125.  
  126.     #define TEXT(a)         a
  127.     #define SIZEOF(x)       sizeof(x)
  128. #else
  129.     #ifndef FNLOCAL
  130.         #define FNLOCAL     _stdcall
  131.         #define FNCLOCAL    _stdcall
  132.         #define FNGLOBAL    _stdcall
  133.         #define FNCGLOBAL   _stdcall
  134.         #define FNWCALLBACK CALLBACK
  135.         #define FNEXPORT    CALLBACK
  136.     #endif
  137.  
  138.     #ifndef _CRTAPI1
  139.     #define _CRTAPI1    __cdecl
  140.     #endif
  141.     #ifndef _CRTAPI2
  142.     #define _CRTAPI2    __cdecl
  143.     #endif
  144.     #ifndef try
  145.     #define try         __try
  146.     #define leave       __leave
  147.     #define except      __except
  148.     #define finally     __finally
  149.     #endif
  150.  
  151.  
  152.     //
  153.     //  there is no reason to have based stuff in win 32
  154.     //
  155.     #define BCODE
  156.  
  157.     #define HUGE
  158.     #define HTASK                   HANDLE
  159.     #define SELECTOROF(a)           (a)
  160.     typedef LRESULT (CALLBACK* DRIVERPROC)(DWORD, HDRVR, UINT, LPARAM, LPARAM);
  161.  
  162.     //
  163.     //  for compiling Unicode
  164.     //
  165.     #ifdef UNICODE
  166.         #define SIZEOF(x)   (sizeof(x)/sizeof(WCHAR))
  167.     #else
  168.         #define SIZEOF(x)   sizeof(x)
  169.     #endif
  170.  
  171.     //
  172.     //  win32 doesn't have to worry about 'huge' data
  173.     //
  174. //  void *memcpy(void *dest, void *src, size_t count);
  175.     #define hmemcpy     memcpy
  176. #endif
  177.  
  178.  
  179. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; 
  180. //
  181. //  misc defines for misc sizes and things...
  182. //
  183. //
  184. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; 
  185.  
  186. //
  187. //  bilingual. this allows the same identifier to be used in resource files
  188. //  and code without having to decorate the id in your code.
  189. //
  190. #ifdef RC_INVOKED
  191.     #define RCID(id)    id
  192. #else
  193.     #define RCID(id)    MAKEINTRESOURCE(id)
  194. #endif
  195.  
  196.  
  197. //
  198. //
  199. //
  200. #define SIZEOF_ARRAY(ar)            (sizeof(ar)/sizeof((ar)[0]))
  201.  
  202.  
  203. //
  204. //  macros to compute block alignment and convert between samples and bytes
  205. //  of PCM data. note that these macros assume:
  206. //
  207. //      wBitsPerSample  =  8 or 16
  208. //      nChannels       =  1 or 2
  209. //
  210. //  the pwfx argument is a pointer to a WAVEFORMATEX structure.
  211. //
  212. #define PCM_BLOCKALIGNMENT(pwfx)        (UINT)(((pwfx)->wBitsPerSample >> 3) << ((pwfx)->nChannels >> 1))
  213. #define PCM_AVGBYTESPERSEC(pwfx)        (DWORD)((pwfx)->nSamplesPerSec * (pwfx)->nBlockAlign)
  214. #define PCM_BYTESTOSAMPLES(pwfx, cb)    (DWORD)(cb / PCM_BLOCKALIGNMENT(pwfx))
  215. #define PCM_SAMPLESTOBYTES(pwfx, dw)    (DWORD)(dw * PCM_BLOCKALIGNMENT(pwfx))
  216.  
  217.  
  218.  
  219. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; 
  220. //
  221. //
  222. //
  223. //
  224. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; 
  225.  
  226. typedef struct tDRIVERINSTANCE
  227. {
  228.     //
  229.     //  although not required, it is suggested that the first two members
  230.     //  of this structure remain as fccType and DriverProc _in this order_.
  231.     //  the reason for this is that the driver will be easier to combine
  232.     //  with other types of drivers (defined by AVI) in the future.
  233.     //
  234.     FOURCC          fccType;        // type of driver: 'audc'
  235.     DRIVERPROC      fnDriverProc;   // driver proc for the instance
  236.  
  237.     //
  238.     //  the remaining members of this structure are entirely open to what
  239.     //  your driver requires.
  240.     //
  241.     HDRVR           hdrvr;          // driver handle we were opened with
  242.     DWORD           vdwACM;         // current version of ACM opening you
  243.     DWORD           fdwOpen;        // flags from open description
  244.  
  245.     DWORD           fdwConfig;      // driver instance configuration flags
  246.  
  247. } DRIVERINSTANCE, *PDRIVERINSTANCE, FAR *LPDRIVERINSTANCE;
  248.  
  249.  
  250.  
  251. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; 
  252. //
  253. //
  254. //
  255. //
  256. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; 
  257.  
  258.  
  259. //
  260. //  This define deals with unaligned data for Win32, and huge data for Win16.
  261. //  Basically, any time you cast an HPBYTE to a non-byte variable (ie long or
  262. //  short), you should cast it to ( {short,long} HUGE_T *).  This will cast
  263. //  it to _huge for Win16, and make sure that there are no alignment problems
  264. //  for Win32 on MIPA and Alpha machines.
  265. //
  266.  
  267. typedef BYTE HUGE *HPBYTE;
  268.  
  269. #ifdef WIN32
  270.     #define HUGE_T  UNALIGNED
  271. #else
  272.     #define HUGE_T  _huge
  273. #endif
  274.  
  275.  
  276. //
  277. //
  278. //
  279. //
  280. typedef DWORD (FNGLOBAL *STREAMCONVERTPROC)
  281. (
  282.     HPBYTE                  pbSrc,
  283.     DWORD                   cbSrcLength,
  284.     HPBYTE                  pbDst,
  285.     UINT                    nBlockAlignment,
  286.     UINT                    cSamplesPerBlock,
  287.     int                 *   pnStepIndexL,
  288.     int                 *   pnStepIndexR
  289. );
  290.  
  291.  
  292. //
  293. //
  294. //
  295. //
  296. typedef struct tSTREAMINSTANCE
  297. {
  298.     STREAMCONVERTPROC   fnConvert;  // stream instance conversion proc
  299.     DWORD               fdwConfig;  // stream instance configuration flags
  300.  
  301.     int                 nStepIndexL; // Used to ensure that the step index
  302.     int                 nStepIndexR; //  is maintained across converts.  For
  303.                                      //  mono signals, the index is stored in
  304.                                      //  nStepIndexL.
  305.  
  306. } STREAMINSTANCE, *PSTREAMINSTANCE, FAR *LPSTREAMINSTANCE;
  307.  
  308.  
  309.  
  310. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; 
  311. //
  312. //  resource id's
  313. //
  314. //
  315. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; 
  316.  
  317. #define ICON_ACM_DRIVER             RCID(10)
  318.  
  319. #define IDS_ACM_DRIVER_SHORTNAME    (1)     // ACMDRIVERDETAILS.szShortName
  320. #define IDS_ACM_DRIVER_LONGNAME     (2)     // ACMDRIVERDETAILS.szLongName
  321. #define IDS_ACM_DRIVER_COPYRIGHT    (3)     // ACMDRIVERDETAILS.szCopyright
  322. #define IDS_ACM_DRIVER_LICENSING    (4)     // ACMDRIVERDETAILS.szLicensing
  323. #define IDS_ACM_DRIVER_FEATURES     (5)     // ACMDRIVERDETAILS.szFeatures
  324.  
  325. #define IDS_ACM_DRIVER_TAG_NAME     (20)    // ACMFORMATTAGDETAILS.szFormatTag
  326.  
  327.  
  328. //
  329. //  global variables, etc...
  330. //
  331. extern HINSTANCE    ghinst;         // DLL instance handle (module in Win 16)
  332.  
  333.  
  334. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; 
  335. //
  336. //
  337. //
  338. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; 
  339.  
  340. #ifndef RC_INVOKED
  341. #pragma pack()                      // revert to default packing
  342. #endif
  343.  
  344. #ifdef __cplusplus
  345. }                                   // end of extern "C" { 
  346. #endif
  347.  
  348. #endif // _INC_CODEC
  349.  
  350.